#!/bin/bash
# About: Quick submit code to UVaOJ, return running status
# Usage: bash uva-check.sh <fileid> <filename>
# now: I can't finish the post function. ai

# addresses
addr_submit="http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=25"
addr_result="uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9"

# -- step 1 -- 提交
# 构造 post file
# localid 
# codeupl
# language value="1" // C
# language value="3" // C++


# -- step 2 -- 获取提交ID
# Submission received with ID 9066208
#submit_id=`echo Submission received with ID 9066208 | \ grep "\bSubmission received" | \ cut -d\  -f5`

#submit_id=6208

# -- step 3 -- 查看结果
#echo Input submit_id or code_id
#read submit_id

submit_id=$1
status=`w3m -cookie $addr_result | grep $submit_id | line`

clear
echo
echo
echo $(color yellow) $status $(color off)
echo


